From db07d8affdc80adf815579307c669951fef7671e Mon Sep 17 00:00:00 2001 From: Ian Campbell Date: Tue, 25 Nov 2014 12:47:08 +0000 Subject: [PATCH] Check that xenstored has actually started before talking to it. Incorporate a timeout so as not to block boot (Mitigates #737613). This code was taken from the upstream initscript and adapted, so it is pretty well tested. (cherry picked from commit 57e0a490c53a029d0921edde9e1acdc158ac2164) Conflicts: debian/changelog debian/xen-utils-common.xen.init Signed-off-by: Ian Jackson --- debian/changelog | 2 ++ debian/xen-utils-common.xen.init | 13 +++++++++++++ 2 files changed, 15 insertions(+) diff --git a/debian/changelog b/debian/changelog index cc1d402940..80e1e6ff7d 100644 --- a/debian/changelog +++ b/debian/changelog @@ -33,6 +33,8 @@ xen (4.8.0-1~) unstable; urgency=high * Start a qemu process in dom0 to service the toolstacks loopback disk attaches. (Closes: #770456) * Remove correct pidfile when stopping xenconsoled. + * Check that xenstored has actually started before talking to it. + Incorporate a timeout so as not to block boot (Mitigates #737613) [ Lubomir Host ] * Fix xen-init-name to not fail looking for a nonexistent 'config' diff --git a/debian/xen-utils-common.xen.init b/debian/xen-utils-common.xen.init index 252ddc0e44..1342a7d5d5 100644 --- a/debian/xen-utils-common.xen.init +++ b/debian/xen-utils-common.xen.init @@ -251,6 +251,19 @@ xenstored_start() start-stop-daemon --start --quiet --pidfile "$XENSTORED_PIDFILE" --exec "$XENSTORED" -- \ $XENSTORED_ARGS --pid-file="$XENSTORED_PIDFILE" \ || return 2 + + # Wait for xenstored to actually come up, timing out after 30 seconds + local time=0 + local timeout=30 + while [ $time -lt $timeout ] && ! `/usr/sbin/xenstore-read -s / >/dev/null 2>&1` ; do + time=$(( $time+1 )) + sleep 1 + done + + # Exit if we timed out + if ! [ $time -lt $timeout ] ; then + return 2 + fi } init_dom0() -- 2.30.2